<?php


	if (PHP_VERSION_ID < 50206)
		die("Requires PHP 5.2.6 or better");
		
	define("FTAORM_FIELD_IS_REQUIRED",-1);
	define("FTAORM_FIELD_IS_INVALID", -2);
	define("FTAORM_RELATIONSHIP_IS_INVALID",-3);
	define("FTAORM_RELATIONSHIP_IS_REQUIRED",-4);
	
	define("FTAORM_ERRORKEY_RELATEDOBJECT","RELATED_OBJECT");
	define("FTAORM_ERRORKEY_RELATED_MANY_TO_MANY_OBJECTS","RELATED_MANY_TO_MANY_OBJECTS");
		
	define("FTAORM_RELATIONSHIP_ONE_TO_ONE",1000);// parent primary key is also child primary key
	define("FTAORM_RELATIONSHIP_ONE_TO_MANY",1001);	// Similar to above, but PK is just a relationship.. 
	define("FTAORM_RELATIONSHIP_MANY_TO_MANY",1002);// many objects realated to this object via an intermediary table.. this requires knowledge about the table at the other end of the join..	
	
	
	
	abstract class FTABaseORM extends FTAObject {
		
		//protected $zdb;// do we need to actuall stick this here????? 
		public $zdb;
		
		function __construct(Zend_Db_Adapter_Abstract $zdb=null){
			parent::__construct();
			$this->zdb = $zdb;			
			
		}
		
		abstract function load($id);
		
		abstract function save($newPrimaryKey=null);
		
		abstract function isValid();
		
		abstract function getValidationErrors();

		
	//	public function setZDB(Zend_Db_Adapter_Abstract $zdb=null){
	//		$this->zdb = $zdb;
	//	}
		
	//	public function getZDB(){
	//		//debug_print_backtrace();
	//		return $this->zdb;
	//	}

	}